
<요구사항>

# Goal
Generate a query set JSON (hybrid search) that contains:
- “topic”
- “keywords” (L1/L2/L3)
- “semantic_sentence”
- “variants”
Strictly follow the Output Format.

# IO
- IN:
  - C-###_info_D_R.json
  - Default_Agent/Keywords_Criteria.txt
- OUT:
  - query_C-###_case_search.json

# Source facts about inputs

A) Main input source: C-###_info_D_R.json
[Only Fields to Use]
- claim_id
- case_kind
- claim_title
- claim_statement
- relief_summary
- cause_summary
- legal_elements

B) Keywords_Criteria.txt
- It specifies criteria for generating three types of keywords to retrieve highly similar precedents:
- L1 = 법리 키워드
- L2 = 사실관계 키워드
- L3 = 조문요건요소 키워드
- You MUST read and apply:
  * # Topic 1: 법리 키워드 추출 기준  -> L1
  * # Topic 2: 사실관계 키워드 추출 기준 -> L2
  * # Topic 3: 조문요건요소 키워드 추출 기준 -> L3

# Output Format (STRICT JSON)
{
“units”: [
{
“unit_id”: “Case-C-###”,
“claim_id”: “C-###”,
“case_kind”: “<case_type>”,
“target”: { “collection”: “”, “tenant”: “” },
“queries”: [
{
“qid”: “C-###-case”,
“topic”: “<20글자 이내>”,
“alpha_basis”: “<법리|사실관계|조문요건|복합>”,
“keywords”: { “L1”: [], “L2”: [], “L3”: [] },
“semantic_sentence”: “<35단어 이내>”,
“variants”: [
{ “variant”: “primary|broad|narrow”, “call”: { “tool”: “search_hybrid”, “args”: { “collection_name”: “”, “tenant”: “”, “query”: “”, “alpha”: 0.55, “limit”: 15, “bm25_operator”: “and”, “fusion_type”: “relative_score” } } }
]
}
]
}
]
}

## Call 객체 (MUST)
{
“tool”: “search_hybrid”,
“args”: {
“collection_name”: “”,
“tenant”: “”,
“query”: “<L1+L2+L3+semantic_sentence 통합>”,
“alpha”: <0.45|0.55|0.65>,
“limit”: <10|15|25>,
“bm25_operator”: “<and|or>”,
“fusion_type”: “<relative_score|ranked>”
}
}

# How to write each field

<method_of_writing_keywords>
1) “keywords” (L1/L2/L3)
Common:
  - Use ONLY `C-###_info_D_R.json` + `Keywords_Criteria.txt`.
  - Apply each criteria section exactly:
  - Topic 1 -> L1 (<=8)
  - Topic 2 -> L2 (<=6)
  - Topic 3 -> L3 (<=6)

Input text for applying criteria:
  - claim_statement (청구내용) 
  - relief_summary (청구취지)
  - cause_summary (청구원인)
  - legal_elements (요건요소 항목들)
</method_of_writing_keywords>

<method_of_writing_semantic_sentence>
2) “semantic_sentence”
## System Requirement (MUST APPLY):
You are a legal-retrieval query writer for Korean litigation precedents.
Your task is to generate up to 3 Korean semantic sentences to retrieve highly similar precedents via vector search (hybrid search context).

## Hard constraints:
- Output MUST be no more than 3 sentences total, in Korean, as plain text (no bullets, no JSON, no headings).
- Do NOT invent facts that are not present in the input. If a detail is missing, omit it rather than guessing.
- Incorporate (as available) the claim type (청구취지), legal basis/cause of action (청구원인), and statutory elements (요건요소/조문요건요소 키워드) together with the core fact pattern.
- Prefer legally canonical phrasing used in judgments (e.g., “채무불이행”, “불법행위”, “부당이득”, “해제/해지”, “인과관계”, “고의·과실”, “위법성”, “손해 및 상당인과관계”).
- Optimize for retrieval recall: include 1–2 key synonym pairs in parentheses only when they materially broaden matching.
- Always bind facts to legal elements using explicit connectors such as “~에 해당하는지”, “~요건(성립요건)”, “~이 쟁점이 되는 사안”.

## Quality target:
- Sentence 1: compact factual pattern and dispute core.
- Sentence 2: cause of action + statutory elements framed as issues to be proven.
- Sentence 3 (optional): requested relief and major contested points (liability scope, defenses).

## How to Perform Tasks (MUST APPLY):
Using ONLY the information below, write a precedent-retrieval semantic text (≤3 sentences total).

[INPUT JSON]
<the current block([Only Fields to Use]) + its generated L1/L2/L3>

Required coverage (use what exists; omit what does not):
- 법률 키워드(“L1”)
- 사실관계 키워드(“L2”)
- 조문요건요소 키워드(“L3”)
- 청구취지(“relief_summary”)
- 청구원인(“cause_summary”) 
- 요건요소(요건사실)(“legal_elements”)

Hard Constraints:
- If the input is long, prioritize: (1) dispute-triggering act/transaction, (2) cause of action, (3) 2–4 most discriminative elements, (4) relief type.
- Do not include: “제공된 정보에 따르면”, “추정컨대”, “알 수 없음”, “N/A”, or any commentary about missing data.

Output rules:
- Plain Korean text, ≤3 sentences total.
- No lists, no citations, no meta commentary.

Example (**format illustration only**):
- Input: 청구원인=민법 제750조 불법행위, 요건요소=고의·과실/위법성/손해/상당인과관계, 사실=온라인 게시물로 명예훼손 주장, 청구취지=손해배상
- Output (≤3 sentences): “피고의 온라인 게시물로 원고의 사회적 평가가 저하되었다고 주장하며 손해배상을 구하는 사안이다. 민법 제750조 불법행위 성립을 위해 피고의 고의·과실, 위법한 표현행위, 원고의 손해 및 상당인과관계가 쟁점이 된다. 원고는 재산상·정신적 손해에 대한 배상을 청구한다.”
</method_of_writing_semantic_sentence>

<method_of_writing_topic>
3) "topic"

## System Requirements (MUST APPLY):
You are a legal topic labeler for Korean precedent retrieval in a hybrid (keyword + vector) search system.

## Task:
Generate a concise “topic” that best represents the current case for retrieving highly similar precedents.

## Hard constraints:
- Do NOT invent facts not present in the input.
- Avoid case-specific identifiers (names, dates, amounts, addresses, account numbers).
- Prefer canonical legal taxonomy used in judgments: e.g., 채무불이행, 불법행위, 부당이득, 해제/해지, 하자, 상당인과관계, 고의·과실, 위법성, 귀책사유, 입증책임.
- The topic must integrate, when available: (i) 청구취지(구제 유형), (ii) 청구원인(법적 성질), (iii) 요건요소(핵심 요건사실), plus the core fact-pattern category.
- Do not output lists, bullet points, headings, citations, or meta commentary.
- If the input is long, prioritize in this order: dispute-triggering transaction/act → cause of action → 2–4 key elements → relief type.
- Add at most one synonym pair in parentheses only when it increases recall (e.g., 채무불이행(불완전이행)).
- Never include phrases like “제공된 정보에 따르면”, “추정컨대”, “알 수 없음”, “N/A”.
- Avoid overly generic topics such as “손해배상 청구”; always anchor to a fact-pattern category (e.g., 임대차/매매/도급/대여금/의료/교통사고 등) when available.

## Output format (choose one):
- Option A (default): Output exactly ONE Korean noun-phrase topic in a single line.
- Option B (if enabled by input flag): Output JSON with two fields:
{“topic_phrase”: “…”, “topic_sentence”: “…”}
            
In both options, keep it compact and discriminative.

## How to perform Task (MUST APPLY):

Generate the topic using ONLY the information below.
[INPUT]
<the current block([Only Fields to Use]) + its generated L1/L2/L3>

Rules:
- If multiple claims/causes exist, prioritize the most central claim and the most discriminative elements.
- Do not repeat raw keyword lists; synthesize them into a legal-topic label.
- Output must follow the System output format.
- 문자 수 상한(topic_phrase 90자): 초과 시 재생성

## Example (**format illustration only**):
Input:
- L1: [채무불이행, 계약해제, 손해배상]
- L2: [매매계약, 목적물 하자, 대금 지급, 하자 통지]
- L3: [하자, 귀책사유, 해제 요건, 손해 및 상당인과관계]
- 청구취지: 매매대금 반환 및 손해배상
- 청구원인: 채무불이행(불완전이행) 및 계약해제
- 요건요소: 하자 존재, 통지, 귀책사유, 손해·인과관계

Output:
“매매 목적물 하자에 따른 계약해제 및 매매대금 반환·손해배상 청구”
</method_of_writing_topic>


<method_of_writing_variants>
4) "variants"

Variant parameter table (MUST):
- primary: bm25_operator=“and”, limit=15, fusion_type=“relative_score” (필수: 모든 query)
- broad:  bm25_operator=“or”,  limit=25, fusion_type=“relative_score” (쟁점 다양성 큼 또는 예외 탐색 필요)
- narrow: bm25_operator=“and”, limit=10, fusion_type=“ranked” (단일 요건요소 정밀 타격)

Variant inclusion rules (minimal, deterministic):
- Always include primary.
- Include broad if unit_type=“defense” OR issue_focus is non-empty OR elements length >=5.
- Include narrow if there exists a single clearly focal element in elements or L3.

Alpha defaults:
- primary alpha=0.55
- broad alpha=0.45
- narrow alpha=0.65
</method_of_writing_variants>

<method_of_writing_alpha_basis>
5) "alpha_basis" (simple rules)

- If L1,L2,L3 all non-empty => “복합”
- Else if only L1 non-empty => “법리”
- Else if only L2 non-empty => “사실관계”
- Else => “조문요건”

</method_of_writing_alpha_basis>

<method_of_writing_each_variant.call.args.query>
6) Construct each variant.call.args.query (single string)
- primary/broad:
  query = “   <semantic_sentence>”
- narrow:
  query = “<top L1 (<=4)> <top L2 (<=2)> <single focal L3/element> <semantic_sentence (trim to <=2 sentences if needed)>”
  Do not add labels like “L1:”.

</method_of_writing_each_variant.call.args.query>

<mapping_DB>
# How to map "Collection" and "Tenant"

## Rule 
- `case_kind`에 대해서 mapping될 Collection과 Tenant 기준 표: 

| case_kind | Collection | Tenant |
|---------------------|------------|--------|
| 사해행위취소 청구 | Analyzed_Cases | Cases_Actio_Pauliana |
| 대여금 청구 | Past_Cases | Cases_Loan_Claim |
| 보증금 청구 | Past_Cases | Cases_Guarantee_Claim |
| 구상금 청구 | Past_Cases | Cases_Indemnity_Claim |
</mapping_DB>

</요구사항>






































